﻿@model Common.Background.WebManageRoles
<fieldset>
    <legend>角色信息</legend>
    <div class="editor-label">
        <span style="color: red; margin-right: 5px;">*</span>名称
    </div>
    <div class="editor-field">
        @Html.EditorFor(model => model.RoleName)
        @Html.ValidationMessageFor(model => model.RoleName)
    </div>
    <div class="editor-label">
        <span style="color: red; margin-right: 5px;">*</span>所属部门
    </div>
    <div class="editor-field">
        @Html.Partial("_DeptTreePartial", new Tuple<string, int?, bool>(null, Model == null ? -1 : Model.DepartmentID, false))
    </div>
    <div class="editor-label">
        <span style="color: red; margin-right: 5px;">*</span>说明
    </div>
    <div class="editor-field">
        @Html.EditorFor(model => model.About)
        @Html.ValidationMessageFor(model => model.About)
    </div>
    <div class="editor-label">
        <span style="color: red; margin-right: 5px;">*</span>排序
    </div>
    <div class="editor-field">
        @Html.EditorFor(model => model.SortNumber)
        @Html.ValidationMessageFor(model => model.SortNumber)
    </div>
    <div class="editor-label"></div>
    <fieldset>
        <legend>操作权限</legend>
        @Html.Partial("OperatorAuthorityPartial", (Model ?? new WebManageRoles()).OperatorAuthority)
    </fieldset>
    <fieldset>
        <legend>可见菜单</legend>
        <div>
            @Html.GetDataTree(ViewBag.MenuList as List<WebManageMenus>
            , "WebManageMenus.MenuID"
            , Model == null || Model.WebManageMenus == null || Model.WebManageMenus.Count == 0 ? new int[] { } : Model.WebManageMenus.Select(i => i.MenuID).ToArray()
            , false
            , "Menu")
        </div>

    </fieldset>
</fieldset>
<script type="text/javascript">
    $(document).ready(function () {
        $(document.getElementById("WebManageMenus.MenuID_Tree")).bind("loaded.jstree", function (e, data) {
            data.inst.open_all(-1); // -1默认全部展开节点 
        }).jstree({
            "plugins": ["themes", "html_data", "ui"]
        });
    });
</script>
